package com.bcu.cn.onlineexamsystem.user.service;

import com.bcu.cn.onlineexamsystem.user.entity.Student;
import com.bcu.cn.onlineexamsystem.Repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {

    @Autowired
    private StudentRepository studentRepository;

    // 获取学生信息
    public Student getStudentById(String userId) {
        return studentRepository.findByUserId(userId);
    }

    // 查询班级学生列表
    public List<Student> getStudentsByClassId(Integer classId) {
        return studentRepository.findByClassId(classId);
    }
}
